set nocompatible              " 去除VI一致性,必须
filetype off                  " 必须

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'fatih/vim-go'
Plugin 'dgryski/vim-godef'
Bundle 'majutsushi/tagbar'

Plugin 'jnwhiteh/vim-golang'
Plugin 'bradfitz/goimports'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'

call vundle#end()            " 必须
filetype plugin indent on    " 必须 加载vim自带和插件相应的语法和文件类型相关脚本

nmap <F4> :TagbarToggle<CR>
let g:tagbar_type_go = {
    \ 'ctagstype' : 'go',
    \ 'kinds'     : [
        \ 'p:package',
        \ 'i:imports:1',
        \ 'c:constants',
        \ 'v:variables',
        \ 't:types',
        \ 'n:interfaces',
        \ 'w:fields',
        \ 'e:embedded',
        \ 'm:methods',
        \ 'r:constructor',
        \ 'f:functions'
    \ ],
    \ 'sro' : '.',
    \ 'kind2scope' : {
        \ 't' : 'ctype',
        \ 'n' : 'ntype'
    \ },
    \ 'scope2kind' : {
        \ 'ctype' : 't',
        \ 'ntype' : 'n'
    \ },
    \ 'ctagsbin'  : 'gotags',
    \ 'ctagsargs' : '-sort -silent'
    \ }

nmap <Leader>tb :TagbarToggle<CR>
let g:tagbar_ctags_bin='ctags'          "ctags路径
let g:tagbar_width=40                   "窗口宽度
let g:tagbar_left=0                     "窗口位置
"下面是自动开启tagbar,若没有安装tagbar插件会报错
"autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx,*.go call tagbar#autoopen()

" 0 复用当前窗口
" 1 水平分裂窗口
" 2 新标签页打开
" 3 垂直分裂窗口
let g:godef_split=0
